package com.stx.stcp.service.impl;

import com.github.pagehelper.PageHelper;
import com.stx.stcp.bean.TypeBean;
import com.stx.stcp.mapper.TypeMapper;
import com.stx.stcp.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeMapper typeMapper;

    @Override
    public List typeList(int pageNum) {
        PageHelper.startPage(pageNum,5);
        List list = typeMapper.typeList();
        return list;
    }

    @Override
    public void insert(TypeBean typeBean) {
        typeMapper.insert(typeBean);
    }

    @Override
    public void delete(int id) {
        typeMapper.delete(id);
    }

    @Override
    public TypeBean selectById(int id) {
        TypeBean typeBean = typeMapper.selectById(id);
        return typeBean;
    }

    @Override
    public void update(TypeBean typeBean) {
        typeMapper.update(typeBean);
    }

    @Override
    public List allTypes() {
        List list = typeMapper.typeList();
        return list;
    }



}
